﻿using System;
using System.Collections.Generic;
using System.Text;

namespace PdfLib.TextScraping
{
    /// <summary>
    /// settings on how to detect table column header layouts
    /// </summary>
    public class TableColumnDetectorInstruction
    {
        private List<string> _ColumnHeadersInFile;
        private ColumnBorderDetectorType _ColumnLayoutDetectionType=ColumnBorderDetectorType.SlidingWindow;
        private int _ColumnHeaderSlidingWindwSize=15;
        private int _ColumnHeaderSlidingWindowStep=5;
        private int _AdjustColumnHeaderWidthFromTableRowCount=5;
        private double _MatchScoreThreshold=0.80;

        /// <summary>
        /// ordered list of column headers
        /// </summary>
        public List<string> ColumnHeadersInFile
        {
            get { return _ColumnHeadersInFile; }
            set { _ColumnHeadersInFile = value; }
        }

        /// <summary>
        /// one of three detection type: sliding window, grid detection from pdf path, 
        /// grid detection from image processing
        /// </summary>
        public ColumnBorderDetectorType ColumnLayoutDetectionType
        {
            get { return _ColumnLayoutDetectionType; }
            set { _ColumnLayoutDetectionType = value; }
        }

        /// <summary>
        /// sliding window height in font size to detect range in y, and x 
        /// that hold all column headers
        /// </summary>
        public int ColumnHeaderSlidingWindwSize
        {
            get { return _ColumnHeaderSlidingWindwSize; }
            set { _ColumnHeaderSlidingWindwSize = value; }
        }

        /// <summary>
        /// row count to look into to adjust column width
        /// </summary>
        public int AdjustColumnHeaderWidthFromTableRowCount
        {
            get { return _AdjustColumnHeaderWidthFromTableRowCount; }
            set { _AdjustColumnHeaderWidthFromTableRowCount = value; }
        }

        /// <summary>
        /// threshold score to match column header
        /// </summary>
        public double MatchScoreThreshold
        {
            get { return _MatchScoreThreshold; }
            set { _MatchScoreThreshold = value; }
        }

        /// <summary>
        /// size of sliding window movement in font size in order to 
        /// detect column header range 
        /// </summary>
        public int ColumnHeaderSlidingWindowStep
        {
            get { return _ColumnHeaderSlidingWindowStep; }
            set { _ColumnHeaderSlidingWindowStep = value; }
        }
    }
}
